﻿using Nasty.Core.Entity;
using Nasty.Core.Entity.Flow;
using Nasty.Core.Entity.System;
using Nasty.Core.LoadParams;
using Nasty.Core.Model;
using Nasty.Core.SuperExtension;
using SqlSugar;

namespace Nasty.Core.Registry
{
    /// <summary>
    /// 流程触发器自动注册接口
    /// </summary>
    public interface IAutofacFlowAction
    {

        /// <summary>
        /// 启动
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<string> Start(Flow flow, FlowNode node);


        /// <summary>
        /// 结束
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<string> End(Flow flow, FlowNode node);

        /// <summary>
        /// 同意
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<string> Agree(Flow flow, FlowNode currentNode, FlowNode? nextNode, User user);

        /// <summary>
        /// 驳回
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<string> Reject(Flow flow, FlowNode currentNode, FlowNode rejectNode);


        /// <summary>
        /// 委派
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<string> Delegate(Flow flow, FlowNode currentNode, User source, User target);

        
        /// <summary>
        /// 分支
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<List<FlowNode>> Branch(Flow flow, FlowNode currentNode, List<FlowNode> nextNodes);

        /// <summary>
        /// 候选人
        /// </summary>
        /// <param name="id"></param>
        /// <param name="nodeCode"></param>
        /// <returns></returns>
        ResultData<FlowCandidateItemModel> Candidate(Flow flow, FlowNode currentNode, FlowNode nextNode);

        /// <summary>
        /// 撤销流程 = 删除流程
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ResultData<string> Revoke(Flow flow);
    }
}
